Skip to content

chore(ui5-avatar): migrate wdio tests to cypress #11817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

NakataCode
Copy link
Contributor

@NakataCode NakataCode commented Jun 30, 2025

Convert Avatar and AvatarGroup tests to Cypress component tests while maintaining test coverage and functionality parity with original specs.

JIRA: BGSOFUIPIRIN-6816

@NakataCode NakataCode marked this pull request as ready for review June 30, 2025 14:10
@dobrinyonkov dobrinyonkov self-requested a review July 22, 2025 12:31
@@ -306,3 +306,183 @@ describe("Fallback Logic", () => {
.should("have.class", "ui5-avatar-fallback-icon-hidden");
});
});

describe("Avatar", () => {
let sharedInputValue = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should no longer need to track events with inputs, with cypress we can create stubs and assert the stubs directly

Example:

cy.get("@avatar")
	.then(avatar => {
		avatar.get(0).addEventListener("ui5-click", cy.stub().as("clickStub"));
	});

cy.get("@avatar")
	.click();

cy.get("@clickStub")
	.should("have.been.calledOnce");

beforeEach(() => {
cy.mount(
<div>
<Avatar id="myAvatar1">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defining every avatar in the beforeEach hook is making the test cases harder to read. Instead, define each avatar with its initial state directly in the mount phase of the test where it’s used.

If an avatar is needed across multiple tests, create a generic one with empty or minimal setup in beforeEach, and set its specific state during the test’s setup phase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants